package com.mi.rof.engineer.guard;

import com.mi.rof.engineer.entity.RepairOrderEvents;
import com.mi.rof.engineer.entity.RepairOrderStates;
import com.mi.rof.entity.SystemException;
import com.mi.rof.entity.enums.ExceptionEnum;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.guard.Guard;
/**
 * @author zwq
 */
public class OrderReviewGuard implements Guard<RepairOrderStates, RepairOrderEvents> {
    @Override
    public boolean evaluate(StateContext<RepairOrderStates, RepairOrderEvents> stateContext) {


        try {
            return (boolean) stateContext.getMessage().getHeaders().get("reviewStatus");
        } catch (Exception e) {
            throw new SystemException(ExceptionEnum.PARAM_LOST.getCode(), ExceptionEnum.PARAM_LOST.getMsg());
        }

    }
}
